# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=xdg-desktop-portal-wlr
pkgver=0.7.1
pkgrel=0
pkgdesc="wlroots implementation of xdg-desktop-portal"
url="https://github.com/emersion/xdg-desktop-portal-wlr"
arch="all"
license="MIT"
depends="
	pipewire
	xdg-desktop-portal
	"
makedepends="
	basu-dev
	inih-dev
	mesa-dev
	meson
	pipewire-dev
	scdoc
	wayland-dev
	wayland-protocols-dev
	xdg-desktop-portal-dev
	"
options="!check"  # no tests provided
subpackages="$pkgname-doc $pkgname-dbg"
source="https://github.com/emersion/xdg-desktop-portal-wlr/releases/download/v$pkgver/xdg-desktop-portal-wlr-$pkgver.tar.gz
	config
	"

# useful since people pulling in xdg-desktop-portal will want this backend
install_if="xdg-desktop-portal wlroots"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dsd-bus-provider=basu \
		. build
	meson compile -C build
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C build
	rm -rf "$pkgdir"/usr/lib/systemd

	install -Dm644 "$srcdir"/config "$pkgdir"/etc/xdg/xdg-desktop-portal-wlr/config
}

sha512sums="
87aa5255d3de3203c2bfa6986c2acbffbfd414d12fb72aeca25249d3b528ffb948858a787c9c4206b18faaddd6ce09c95c257e969cc3cfeee8e376c3846f2b9d  xdg-desktop-portal-wlr-0.7.1.tar.gz
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e  config
"
